/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}


/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {

	"use strict";

	/*
	 * @Author: jiaolong
	 * @Date: 2018-11-23 09:58:31
	 * @Last Modified by: jiaolong
	 * @Last Modified time: 2019-03-07 15:14:56
	 * 58滑块变更网易盾滑块
	 */

	$(document).ready(function () {
	    var rid = "";
	    var captchaIns = "";
	    initNECaptcha({
	        // config对象，参数配置
	        captchaId: "e11978dc94fe431eb2ec9c510ddf97b9",
	        element: "#captcha",
	        mode: "popup",
	        width: "380px",
	        // 用户验证码验证成功后，进行实际的提交行为
	        onVerify: function onVerify(err, data) {
	            if (data) {
	                $("#successToken").val(data.validate);
	                getVerificationCode();
	            }
	        }
	    }, function onload(instance) {
	        // 初始化成功后得到验证实例instance，可以调用实例的方法
	        console.log(instance);
	        captchaIns = instance;
	    }, function onerror(err) {
	        console.log("error", err);
	        // 初始化失败后触发该函数，err对象描述当前错误信息
	    });
	    $("#findpass_button_1").click(function () {
	        if (!regPhone()) {
	            return false;
	        }
	        captchaIns && captchaIns.refresh();
	        captchaIns && captchaIns.popUp();
	    });

	    $("#phone").keyup(function () {
	        regPhone();
	    });

	    function regPhone() {
	        var reg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/; // 修改与2018年07月23日
	        var phone = $('#phone').val();
	        if (!reg.test(phone) || phone == $("#phone").attr("placeholder")) {
	            $('#phone').next().text("请输入有效的手机号码");
	            $('#phone').next().next().hide();
	            $('#phone').next().css('visibility', 'visible');
	            return false;
	        } else {
	            $('#phone').next().text("");
	            $('#phone').next().next().show();
	            $('#phone').next().css('visibility', 'hidden');
	        }
	        return true;
	    }
	    $(".obtain_btn").click(function () {
	        if (!regPhone()) {
	            return false;
	        }
	        if (!regNewPassword()) {
	            return false;
	        }
	        if (!confirmPassword()) {
	            return false;
	        }
	        captchaIns && captchaIns.refresh();
	        captchaIns && captchaIns.popUp();
	    });

	    /**
	     * 获取验证码
	     * @param {*} phone 手机号
	     * @param {*} el 获取验证码按钮
	     */
	    function getVerificationCode() {
	        var d = new Date();
	        var time = d.getTime();
	        $.ajax({
	            dataType: 'json',
	            type: 'get',
	            url: '/captcha/pcSendCode',
	            data: {
	                t: 1,
	                m: 1,
	                p: 1,
	                mobile: $("#phone").val(),
	                successToken: $("#successToken").val(),
	                _: time
	            },
	            success: function success(res) {
	                if (res.code == 0) {
	                    var n = 60;
	                    rid = res.result.rid;
	                    // $('.verification_phone').hide();
	                    // $('.verification_code').show();
	                    $('.obtain_btn').attr('disabled', 'true');
	                    $('.obtain_btn').css({
	                        'cursor': 'not-allowed',
	                        'backgroundColor': 'rgb(242, 242, 242)',
	                        'color': '#00c356'
	                    });
	                    var timer = setInterval(function () {
	                        $('.obtain_btn').text(n + '秒后重新获取');
	                        n--;
	                        if (n == 0) {
	                            clearInterval(timer);
	                            $('.obtain_btn').text('获取验证码');
	                            $('.obtain_btn').removeAttr("disabled");
	                            $('.obtain_btn').css({
	                                'backgroundColor': '#00C356',
	                                'color': '#ffffff',
	                                'cursor': 'pointer'
	                            });
	                        }
	                    }, 1000);
	                } else {
	                    $("#phone").next().css('visibility', 'visible');
	                    $("#phone").next().text(res.msg);
	                }
	            }
	        });
	    }

	    $("#findpass_button_2").click(function () {
	        if (!regNewPassword()) {
	            return false;
	        }
	        if (!confirmPassword()) {
	            return false;
	        }
	        if (!regCode()) {
	            return false;
	        }
	        if (!$("#successToken").val() || !rid) {
	            $(".print_code").next().next().css("visibility", "visible");
	            $(".print_code").next().next().text("请完成滑块后提交");
	            $(".print_code").next().next().next().hide();
	            return false;
	        }
	        submit();
	    });

	    $(".print_code").keyup(function () {
	        regCode();
	    });

	    /**
	     * 验证码校验
	     */
	    function regCode() {
	        var code = $.trim($(".print_code").val());
	        if (code == "" || code == $(".print_code").attr("placeholder")) {
	            $(".print_code").next().next().css("visibility", "visible");
	            $(".print_code").next().next().text("请输入验证码");
	            $(".print_code").next().next().next().hide();
	            return false;
	        } else if ($(".print_code").val().length != 4) {
	            $(".print_code").next().next().css("visibility", "visible");
	            $(".print_code").next().next().text("短信验证码错误");
	            $(".print_code").next().next().next().hide();
	            return false;
	        } else {
	            $(".print_code").next().next().css("visibility", "hidden");
	            $(".print_code").next().next().text("");
	            $(".print_code").next().next().next().show();
	        }
	        return true;
	    }

	    $("#newPassword").keyup(function () {
	        regNewPassword();
	    });

	    /**
	     * 新密码校验
	     */
	    function regNewPassword() {
	        var pwd = $("#newPassword").val();
	        if (!regPhone()) {
	            return false;
	        }
	        var regpwd = /^(?![\d]+$)(?![a-zA-Z]+$)(?![^\da-zA-Z]+$).{8,20}$/;
	        if (pwd == "" || pwd == $("#newPassword").attr("placeholder")) {
	            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                $("#newPassword").next().next().css("visibility", "visible");
	                $("#newPassword").next().next().text("请输入密码");
	                $("#newPassword").next().next().next().hide();
	            } else {
	                $("#newPassword").next().css("visibility", "visible");
	                $("#newPassword").next().text("请输入密码");
	                $("#newPassword").next().next().hide();
	            }

	            return false;
	        } else if (!regpwd.test($("#newPassword").val())) {
	            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                $("#newPassword").next().next().css("visibility", "visible");
	                $("#newPassword").next().next().text("密码格式有误(字母、数字或者符号,最短8位)");
	                $("#newPassword").next().next().next().hide();
	            } else {
	                $("#newPassword").next().css("visibility", "visible");
	                $("#newPassword").next().text("密码格式有误(字母、数字或者符号,最短8位)");
	                $("#newPassword").next().next().hide();
	            }
	            return false;
	        } else if ($("#newPassword").val().indexOf($("#phone").val()) >= 0) {
	            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                $("#newPassword").next().next().css("visibility", "visible");
	                $("#newPassword").next().next().text("密码不能包含手机号码");
	                $("#newPassword").next().next().next().hide();
	            } else {
	                $("#newPassword").next().css("visibility", "visible");
	                $("#newPassword").next().text("密码不能包含手机号码");
	                $("#newPassword").next().next().hide();
	            }
	            return false;
	        } else {
	            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                $("#newPassword").next().next().css("visibility", "hidden");
	                $("#newPassword").next().next().text("");
	                $("#newPassword").next().next().next().show();
	            } else {
	                $("#newPassword").next().css("visibility", "hidden");
	                $("#newPassword").next().text("");
	                $("#newPassword").next().next().show();
	            }
	        }
	        return true;
	    }

	    $("#confirmPassword").keyup(function () {
	        confirmPassword();
	    });

	    /**
	     * 密码二次校验
	     */
	    function confirmPassword() {
	        var pwd = $("#newPassword").val();
	        var confirmPwd = $("#confirmPassword").val();
	        if (pwd != confirmPwd) {
	            if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                $("#confirmPassword").next().next().css("visibility", "visible");
	                $("#confirmPassword").next().next().text("两次密码不一致，请重新输入");
	                $("#confirmPassword").next().next().next().hide();
	            } else {
	                $("#confirmPassword").next().css("visibility", "visible");
	                $("#confirmPassword").next().text("两次密码不一致，请重新输入");
	                $("#confirmPassword").next().next().hide();
	            }
	            return false;
	        }
	        if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	            $("#confirmPassword").next().next().css("visibility", "hidden");
	            $("#confirmPassword").next().next().text("");
	            $("#confirmPassword").next().next().next().show();
	        } else {
	            $("#confirmPassword").next().css("visibility", "hidden");
	            $("#confirmPassword").next().text("");
	            $("#confirmPassword").next().next().show();
	        }

	        return true;
	    }

	    /**
	     * 修改密码提交
	     */
	    function submit() {
	        $.ajax({
	            type: 'POST',
	            url: "/findPasswordByPhone",
	            data: {
	                phone: $("#phone").val(),
	                newPassword: $("#newPassword").val(),
	                successToken: $("#successToken").val(),
	                xcodesessionid: $("#xcodesid").val(),
	                code: $(".print_code").val(),
	                phonerid: rid
	            },
	            success: function success(res) {
	                var res = JSON.parse(res);
	                if (res.code == "0") {
	                    $("#findpass_button_2").text("亲，密码修改成功哦~将于3秒后跳转登录页面");
	                    setTimeout(function () {
	                        window.location.href = res.url;
	                    }, 3000);
	                } else {
	                    $(".obtain_btn").next().css("visibility", "visible");
	                    $(".obtain_btn").next().text(res.msg);
	                    $(".obtain_btn").next().next().hide();
	                }
	                // else if (res.code == "-1003") {
	                //     $(".obtain_btn").next().css("visibility", "visible");
	                //     $(".obtain_btn").next().text(res.msg);
	                //     $(".obtain_btn").next().next().hide();
	                // } else if (res.code == "-1004") {
	                //     if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                //         $(".obtain_btn").next().css("visibility", "visible");
	                //         $(".obtain_btn").next().text(res.msg);
	                //     } else {
	                //         $(".obtain_btn").next().css("visibility", "visible");
	                //         $(".obtain_btn").next().text(res.msg);
	                //     }
	                // } else if (res.code == "-1005") {
	                //     if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                //         $("#confirmPassword").next().next().css("visibility", "visible");
	                //         $("#confirmPassword").next().next().text(res.msg);
	                //     } else {
	                //         $("#confirmPassword").next().css("visibility", "visible");
	                //         $("#confirmPassword").next().text(res.msg);
	                //     }
	                // } else if (res.code == "-1000") {
	                //     if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i) == "9.") {
	                //         $("#confirmPassword").next().next().css("visibility", "visible");
	                //         // $("#confirmPassword").next().next().text(res.msg);
	                //         $("#confirmPassword").next().next().text("找回密码失败，请刷新页面重试");
	                //     } else {
	                //         $("#confirmPassword").next().css("visibility", "visible");
	                //         // $("#confirmPassword").next().text(res.msg);
	                //         $("#confirmPassword").next().text("找回密码失败，请刷新页面重试");
	                //     }
	                // }
	            },
	            error: function error(data) {}
	        });
	    }
	});

/***/ })
/******/ ]);